package cn.vawn.base.mapper;

import cn.vawn.base.entity.SmsVCodeBlackWhiteRecord;
import org.apache.ibatis.annotations.Param;
import org.springframework.stereotype.Repository;

import java.util.Date;
import java.util.List;

@Repository
public interface SmsVCodeBlackWhiteRecordMapper {

    int insert(SmsVCodeBlackWhiteRecord record);

    int insertSelective(SmsVCodeBlackWhiteRecord record);

    /**
     * 根据手机号或者ip和指定时间获取在黑名单的记录
     * @param smsVCodeBlackWhiteRecord
     * @param time
     * @return
     */
    List<SmsVCodeBlackWhiteRecord> getBlackRecordByMobileOrIp(@Param("smsVCodeBlackWhiteRecord") SmsVCodeBlackWhiteRecord smsVCodeBlackWhiteRecord,
                                                              @Param("time") Date time);

    /**
     * 清理结束时间早于指定日期的记录
     * @param invalidTime
     */
    void cleanBeforeRecord(@Param("invalidTime") Date invalidTime);
}